<template>
  <div class="container">
    <FmTable   ref="fmTable" url="/process/generator" id="id" tableName="templategroup"  :columns="columns"
              :toolbar="['add','del']">
      <template #opt="scope">
      <el-button link type="primary" size="small" @click="onSelectTemplate(scope.row)">查看模板</el-button>
                <el-button link type="primary" size="small" @click="fmTable.handleEdit(scope.$index, scope.row)">修改</el-button>
      </template>
    </FmTable>
  </div>
</template>

<script setup lang="ts">
import {fetchData,delData, saveorUpadateDate,deteleAllData} from '@/api';
import {ref,reactive,onMounted} from "vue";
import {ElMessage, ElMessageBox, FormInstance} from "element-plus";
import {useRouter} from "vue-router";
let router=useRouter()
let tableData=ref([])
let groupTitle=ref('')
let groupDlgShow=ref(false)
let formData=reactive({
  id: 0,
  groupName: ''
})
let dialogForm=ref<FormInstance>(null)
let formRules=reactive({
  groupName: [
    { required: true, message: '不能为空', trigger: 'blur' }
  ]
})

const columns=[
  {
    "label": "分组编号",//标签名称
    "index": "id",//数据库索引
    "rules": [
      {required: true, message: "请输入主键", trigger: "blur",},
    ],//值规则
    "search": true,//是否是搜索表单
    "dataType": "text",//值值类型默认字符类型
    "addable": false,
    "upd-disabled":true
  },
  {
    "label": "分组名称",//标签名称
    "index": "groupName",//数据库索引
    "rules": [
      { required: true, message: '不能为空', trigger: 'blur' }
    ],//值规则
    "search": true,//是否是搜索表单
    "dataType": "text",//值值类型默认字符类型
  },
  {
    "type": "opt",//普通行，字典行，自定义行
    "label": "操作",//标签名称
    "index": "opt",//数据库索引
    "rules": [],//值规则
    "width": 150,
    "dataType": "text",//值值类型默认字符类型
  }
]
const onSelectTemplate=(row:any)=> {
  router.push(`/admin/tool/generate/template?groupId=${row.id}`)
}
const fmTable=ref(null)

</script>
